package leetcode.jianzhioffer;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-11-01 10:02
 **/
public class JianZhiOffer46 {

    public int translateNum(int num) {
        //滚动数组
        int p = 0;
        int q = 1;
        int r = 1;
        String str = String.valueOf(num);
        for (int i = 1; i < str.length(); i++) {
            p = q;
            q = r;
            String sub = str.substring(i - 1, i + 1);
            r = sub.compareTo("10") >= 0 && sub.compareTo("25") <= 0 ? r + p : r;
        }
        return r;
    }

}
